# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-javalang
pkgname=('python2-javalang' 'python-javalang')
_pkgname=javalang
pkgver=0.13.0
pkgrel=6
pkgdesc='Pure Python Java parser and tools.'
arch=('any')
url='https://pypi.org/project/javalang/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('260cb4f356a88ae17eaeec9221b48eb9ebe21c81d7e364e8624ed059613e72c4a84d3d08c67fb3ab366072f6687dbf0cf638a63699ce5a03b8f2674479364014')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-javalang() {
  depends=('python2' 'python2-six' 'java-runtime')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-javalang() {
  depends=('python' 'python-six' 'java-runtime')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

